//test
package cs341.cs.uwosh.edu.jBeats;

import javax.swing.JFrame;
import javax.swing.WindowConstants;

/**
 * @author haibut41
 */

/*
 * This class is used to create all the different views that will be loaded
 * As you travel through the UI. This class will handle getting the data out
 * from where we store the information from the database and loading this data
 * into the frame, before then passing the frame to what called it, which
 * will then display the frame. This allows a method to create a new frame
 * in a single line somewhere along the lines of
 * jBeatsMain frame = FrameCreator.createMain(...);
 * with only a few variables such as user or song name passed in.
 */
public class FrameCreator {
    
    FrameCreator(){
        
    }
    
    public jBeatsLogin createLogin(){
        jBeatsLogin frame = new jBeatsLogin();
        
        return frame;
    }
    
    public static jBeatsMain createMain(String user){
        Song[] songlist = DatabaseInfo.getSongList(user, "master");
        String[] playlistList = DatabaseInfo.getPlaylists(user);
        jBeatsMain frame = new jBeatsMain(user,songlist,playlistList);
        
        return frame;
    
    }
    
    public jBeatsUser createUser(String user, String[] playlist){
        jBeatsUser frame = new jBeatsUser(DatabaseInfo.getUserInfo(user), playlist);
        //frame.setUsername(user);
        return frame;
    }
    
    public jBeatsUserReviews createUserReviews(String user){
        jBeatsUserReviews frame = new jBeatsUserReviews(user);
        //String[] stuff = DatabaseInfo.getUserReviews(user);
        return frame;
    }
    
    public jBeatsSongReviews createSongReviews(Song song){
        jBeatsSongReviews frame = new jBeatsSongReviews(song);
        return frame;
    }

    public jBeatsAddUser createAddUser(){
        jBeatsAddUser frame = new jBeatsAddUser();
        return frame;
    }
    
    public jBeatsHelp createHelp(){
        jBeatsHelp frame = new jBeatsHelp();
        return frame;
    }

    ImportSong ImportSong() {
        ImportSong frame = new ImportSong();
        return frame;
    }

    jBeatsEditSongInfo createEditSongInfo(String user, Song song) {
        jBeatsEditSongInfo esi = new jBeatsEditSongInfo(user, song);
        //esi.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        return esi;
    }

    AddReview createAddReview(String user, Song song) {
        AddReview frame = new AddReview(user, song);
        return frame;
    }

    jBeatsDeleteUser createDeleteUser(String user) {
        jBeatsDeleteUser a = new jBeatsDeleteUser(user);
        return a;
    }

    jBeatsMakeAdmin createjBeatsMakeAdmin(String user) {
        jBeatsMakeAdmin a = new jBeatsMakeAdmin(user);
        return a;
    }

    jBeatsEditPlaylistName createjBeatsEditPlaylistName(String name, jBeatsMain mainWindow) {
        jBeatsEditPlaylistName a = new jBeatsEditPlaylistName(name, mainWindow);
        return a;
    }

    jBeatsAddSongtoPlaylist createjBeatsAddSongToPlaylist(int song, String songname, String user) {
        jBeatsAddSongtoPlaylist a = new jBeatsAddSongtoPlaylist(song, songname, user);
        return a;
    }
}
